import moment from 'moment';
// 命名规范：Arr普通枚举  field下拉字段枚举  Map表格字段枚举

// 表头筛选字段
const headerForm = {};
// 表格字段
const tableColumn = {
  // 表格列表
  marketPointTableMap: [
    {
      prop: 'id',
      type: 'text',
      label: 'ID',
    },
    {
      prop: 'title',
      type: 'text',
      label: '套餐标题',
    },
    {
      prop: 'money',
      type: 'text',
      label: '充值金额',
    },
    {
      prop: 'giftPoint',
      type: 'text',
      label: '赠送积分',
    },
    {
      prop: 'point',
      type: 'text',
      label: '兑换积分',
    },
    {
      prop: 'status',
      type: 'text',
      label: '状态',
      optionKey: 'COVERT_STATUS',
    }
  ],
};
// 表单字段
const editForm = {
  // 筛选表单
  marketPointFilterMap: [
    {
      prop: 'title',
      type: 'input',
      label: '套餐标题',
      col: 0,
    },
    {
      prop: 'money',
      type: 'inputNumber',
      label: '充值金额',
      col: 0,
    },
    {
      prop: 'giftPoint',
      type: 'inputNumber',
      label: '赠送积分',
      col: 0,
    },
    
    {
      prop: 'point',
      type: 'inputNumber',
      label: '兑换积分',
      col: 0,
    },
    {
      prop: 'status',
      type: 'select',
      label: '状态',
      optionKey: 'COVERT_STATUS',
      col: 0,
    },
    {
      prop: 'createTime',
      label: '创建时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
    {
      prop: 'updateTime',
      label: '更新时间',
      type: 'datePicker',
      dateType: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd',
      pickerOptions: {
        disabledDate: function (time) {
          return time.getTime() > moment().format('x');
        },
      },
      clearable: true,
      col: 0,
    },
  ],
  // 新增/修改表单
  marketPointFormMap: [
    {
      prop: 'title',
      type: 'input',
      label: '套餐标题',
      col: 24,
    },
    {
      prop: 'money',
      type: 'inputNumber',
      label: '充值金额',
      col: 24,
    },
    {
      prop: 'giftPoint',
      type: 'inputNumber',
      label: '赠送积分',
      col: 24,
    },
    {
      prop: 'point',
      type: 'inputNumber',
      label: '兑换积分',
      col: 24,
    },
    {
      prop: 'status',
      type: 'radio',
      label: '状态',
      optionKey: 'COVERT_STATUS',
      col: 24,
    }
  ],
};
// 其他映射
const otherMap = {};
// 表单字段校验
const editRule = {
  marketPointFormRule: {
    title: [{ required: true, message: '套餐标题不能为空', trigger: 'blur' }],
    money: [{ required: true, message: '充值金额不能为空', trigger: 'blur' }],
    status: [{ required: true, message: '请选择状态', trigger: 'change' }],
  },
};
export default {
  headerForm,
  tableColumn,
  editForm,
  otherMap,
  editRule,
};
